<include file="header"/>
<div class="wraper">
	<div class="head">
		<a href="javascript:history.back(-1);" class="iconfont icon-fanhui72"></a>
		<span class="head-name">寻找物品</span>
	</div>
	<p class="field">物品名称</p>
	<p class="form-list"><input id="name" placeholder="请输入丢失物品的名称"/></p>
	<p class="field">遗失地点</p>
	<p class="form-list"><input id="address" placeholder="请输入丢失地点"/></p>
	<p class="field">详情描述</p>
	<p class="form-list"><textarea id="description" placeholder="请详细描述丢失物品的特征"></textarea></p>
	<p class="field">姓名</p>
	<p class="form-list"><input id="username" placeholder="请输入丢失人姓名"/></p>
	<p class="field">联系方式</p>
	<p class="form-list"><input id="mobile" placeholder="请输入丢失人的手机号码"/></p>
	<div class="btn-box"><a href="#" class="btn">提交</a></div>
	<!--<include file="menu"/>-->
</div>
<include file="commonJS"/>
<script>
	$(function(){
		var height = $(document).height();
		$('.record-contain').css("height",height*0.69);
		$(document).on('click','.btn',function(){
	    	var json={};
			var data={};
			data.name=$('#name').val();
			data.address=$('#address').val();
	    	data.description=$('#description').val();
	    	data.username=$('#username').val();
	    	data.mobile=$('#mobile').val();
	    	var isMobile=/^(?:13\d|15\d|18\d)\d{5}(\d{3}|\*{3})$/;
	    	data.type=1;
	    	if(!data.name){
				$.alert('error','请输入物品名称');return false;
			}else if(!data.address){
				$.alert('error','请输入遗失地点');return false;
			}else if(!data.description){
				$.alert('error','请输入物品描述');return false;
			}else if(!data.username){
				$.alert('error','请输入丢失人姓名');return false;
			}else if(!isMobile.test(data.mobile)){
				$.alert('error','请输入正确的手机号码');return false;
			}
	    	json.data=data;
			json.url="{BEESCRM::U('/base/Found/lostFound',array('wechat_id'=>$wechat_id))}";
			json.method='post';
			json.type='json';
			$.getAjax(json,true,reload,'');
    	});
		//页面刷新
		function reload() {
			setTimeout('location.href="{BEESCRM::U('/base/Found/center',array('wechat_id'=>$wechat_id))}"', 2000);
		}
	});
	
</script>
</body>
</html>
